import { User } from '@/types/user';

// 简单的 ID 生成函数
const generateId = (): string => {
  return Date.now().toString(36) + Math.random().toString(36).substr(2);
};

export const mockUsers: User[] = [
  {
    id: '1',
    username: 'admin',
    email: 'admin@company.com',
    displayName: '系统管理员',
    avatar: '',
    role: 'admin',
    status: 'active',
    department: 'IT部门',
    position: '系统管理员',
    phone: '13800138001',
    createdAt: '2024-01-01T10:00:00Z',
    updatedAt: '2024-01-15T14:30:00Z',
    lastLoginAt: '2024-01-15T09:15:00Z',
  },
  {
    id: '2',
    username: 'manager1',
    email: 'manager1@company.com',
    displayName: '张经理',
    avatar: '',
    role: 'manager',
    status: 'active',
    department: '产品部门',
    position: '产品经理',
    phone: '13800138002',
    createdAt: '2024-01-02T11:00:00Z',
    updatedAt: '2024-01-14T16:20:00Z',
    lastLoginAt: '2024-01-15T08:45:00Z',
  },
  {
    id: '3',
    username: 'dev1',
    email: 'dev1@company.com',
    displayName: '李开发',
    avatar: '',
    role: 'user',
    status: 'active',
    department: '技术部门',
    position: '前端开发工程师',
    phone: '13800138003',
    createdAt: '2024-01-03T09:30:00Z',
    updatedAt: '2024-01-13T11:10:00Z',
    lastLoginAt: '2024-01-14T17:30:00Z',
  },
  {
    id: '4',
    username: 'dev2',
    email: 'dev2@company.com',
    displayName: '王开发',
    avatar: '',
    role: 'user',
    status: 'active',
    department: '技术部门',
    position: '后端开发工程师',
    phone: '13800138004',
    createdAt: '2024-01-04T14:20:00Z',
    updatedAt: '2024-01-12T09:45:00Z',
    lastLoginAt: '2024-01-14T16:15:00Z',
  },
  {
    id: '5',
    username: 'designer1',
    email: 'designer1@company.com',
    displayName: '赵设计',
    avatar: '',
    role: 'user',
    status: 'active',
    department: '设计部门',
    position: 'UI设计师',
    phone: '13800138005',
    createdAt: '2024-01-05T16:10:00Z',
    updatedAt: '2024-01-11T13:25:00Z',
    lastLoginAt: '2024-01-13T10:20:00Z',
  },
  {
    id: '6',
    username: 'test1',
    email: 'test1@company.com',
    displayName: '刘测试',
    avatar: '',
    role: 'user',
    status: 'inactive',
    department: '质量部门',
    position: '测试工程师',
    phone: '13800138006',
    createdAt: '2024-01-06T12:30:00Z',
    updatedAt: '2024-01-10T15:40:00Z',
    lastLoginAt: '2024-01-10T14:55:00Z',
  },
  {
    id: '7',
    username: 'sales1',
    email: 'sales1@company.com',
    displayName: '陈销售',
    avatar: '',
    role: 'user',
    status: 'active',
    department: '销售部门',
    position: '销售经理',
    phone: '13800138007',
    createdAt: '2024-01-07T08:45:00Z',
    updatedAt: '2024-01-09T10:30:00Z',
    lastLoginAt: '2024-01-12T09:10:00Z',
  },
  {
    id: '8',
    username: 'guest1',
    email: 'guest1@company.com',
    displayName: '临时用户',
    avatar: '',
    role: 'guest',
    status: 'suspended',
    department: '其他',
    position: '访客',
    phone: '13800138008',
    createdAt: '2024-01-08T13:15:00Z',
    updatedAt: '2024-01-08T13:15:00Z',
    lastLoginAt: '2024-01-08T13:20:00Z',
  },
];

export const generateMockUser = (overrides: Partial<User> = {}): User => {
  const now = new Date().toISOString();
  return {
    id: generateId(),
    username: 'newuser',
    email: 'newuser@company.com',
    displayName: '新用户',
    role: 'user',
    status: 'active',
    department: '未分配',
    position: '员工',
    createdAt: now,
    updatedAt: now,
    ...overrides,
  };
}; 